
//
//  UIView+SizeExt.m
//  LotteryPractice
//
//  Created by Zhu Jinxin on 16/5/28.
//  Copyright © 2016年 Zhu Jinxin. All rights reserved.
//

#import "UIView+SizeExt.h"

@implementation UIView (SizeExt)

-(void)setCenterX:(CGFloat)centerX{
    
    self.frame = CGRectMake(centerX-self.frame.size.width/2, self.frame.origin.y, self.frame.size.width, self.frame.size.height);
    
}

-(CGFloat)centerX{
    
    return  self.center.x;
    
}

-(void)setCenterY:(CGFloat)centerY{
    
    self.frame = CGRectMake(self.frame.origin.x, centerY - self.frame.size.height/2, self.frame.size.width, self.frame.size.height);
    
}

-(CGFloat)centerY{
    
    return self.center.y;
    
}



-(void)setX:(CGFloat)x{
    
    CGRect fram = self.frame;
    
    fram.origin.x = x;
    
    self.frame = fram;
    
}

-(CGFloat)x{
    
    return self.frame.origin.x;
    
}

- (void)setY:(CGFloat)y{
    
    CGRect fram = self.frame;
    
    fram.origin.y = y;
    
    self.frame = fram;
    
    
}


- (CGFloat)y{
    
    return self.frame.origin.y;
    
}

- (void)setW:(CGFloat)w{
    
    CGRect fram = self.frame;
    
    fram.size.width = w;
    
    self.frame = fram;
    
}

- (CGFloat)w{
    
    return self.frame.size.width;
    
}

- (void)setH:(CGFloat)h{
    

    CGRect fram = self.frame;
    
    fram.size.height = h;
    
    self.frame = fram;
    
}

- (CGFloat)h{
    
    return self.frame.size.height;
    
}



@end
